const express = require('express');
const router = express.Router();

router.get('/', (req, res) => {
    const content = [];
    for(let i = 0; i < 100; i++)
        content.push({
            id: `2020${i}`,
            targetYear: 2020,
            brandCode: 'string',
            brandName: 'string',
            marketDepartmentName: 'string',
            dealerCode: 'string',
            country: 'string',
            businessType: 1,
            status: 1,
            creatorName: 'string',
            createTime: '2020-02-17T08:24:39.398Z',
            remark: 'string',
            rowVersion: 'string',
            options: ['update', 'abandon']
        });
    res.json({
        message: '',
        payload: {
            content,
            totalElements: 100,
        }
    });
});

router.get('/:id', (req, res) => {
    res.json(
        {
            message: 'string',
            payload: {
                id: '20191',
                targetYear: 2020,
                brandCode: 'string',
                brandName: 'string',
                marketDepartmentName: 'string',
                dealerCode: 'string',
                country: 'string',
                businessType: 1,
                status: 1,
                creatorName: 'string',
                createTime: '2020-02-17T08:24:39.398Z',
                remark: 'string',
                rowVersion: 'string',
                options: ['update', 'abandon'],
                details: [{
                    id: 'string',
                    isNewModel: true,
                    businessType: 1,
                    modelCode: 'string',
                    modelName: 'string',
                    versionCode: 'string',
                    versionName: 'string',
                    materialGroupKDBOMCode: 'string',
                    n1SalesTargetQuantity: 10,
                    n2SalesTargetQuantity: 20,
                    n3SalesTargetQuantity: 30,
                    n4SalesTargetQuantity: 40,
                    n5SalesTargetQuantity: 50,
                    n6SalesTargetQuantity: 60,
                    n7SalesTargetQuantity: 70,
                    n8SalesTargetQuantity: 80,
                    n9SalesTargetQuantity: 90,
                    n10SalesTargetQuantity: 100,
                    n11SalesTargetQuantity: 120,
                    n12SalesTargetQuantity: 130,
                    totalQuantity: 1000,
                    remark: 'string'
                }]
            }
        }
    );
});

router.put('/:id', (req, res) => {
    res.json(
        {
            message: '修改成功'
        }
    );
});

router.put('/:id/abandon', (req, res) => {
    res.json({
        message: '作废成功'
    });
});

module.exports = router;
